<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .inner {
      width: 50%;
      height: 20px;
      border-radius: 10px;
      /* float: right; */
      text-align: right;
      position: relative;
      background-color: skyblue;
      background-size: 20px 20px;
      box-sizing: border-box;
      transition: all 1s;
      /* 加一个动画的效果 */
    }

    .progress {
      height: 20px;
      width: 400px;
      border-radius: 15px;
      background-color: #272425;
      box-sizing: border-box;
      margin-bottom: 30px;
    }

    button {
      margin-right: 20px;
    }

    .active {
      background-color: skyblue;
      border: 1px solid pink;
    }
  </style>
</head>

<body>
  <div id="app">
    <div class="progress">
      <div class="inner" :style="{width: size + '%'}">
        <span>{{size}}%</span>
      </div>
    </div>

    <button v-for="(item, index) in list" :key="item.id" @click="size = item.changeSize, activeIndex = index"
      :class="{ active: index == activeIndex}">设置{{item.changeSize}}%</button>
  </div>
  <script src="../vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        size: 50,
        activeIndex: 2,
        list: [
          { id: 0, changeSize: 0 },
          { id: 1, changeSize: 25 },
          { id: 2, changeSize: 50 },
          { id: 3, changeSize: 75 },
          { id: 4, changeSize: 100 }
        ]
      },
      methods: {
      }
    })
  </script>
</body>

</html>